﻿using System.Collections.Generic;
using FollowMe.Model;
using FollowMe.Services.Response;
using FollowMe.Services.View;

namespace FollowMe.Services.Mappers
{
    public static class LocationExtensionMethods
    {
        public static LocationView ConvertToLocationView(this Location location)
        {
            return new LocationView
            {
                locationID = location.LocationID,
                date = location.Date,
                memberID = location.MemberID,
                lattitude = location.Lattitude,
                longitude = location.Longitude,
                note = location.Note
            };
        }

        public static IList<LocationView> ConvertToLocationViews(this IEnumerable<Location> locations)
        {
            IList<LocationView> locationViews = new List<LocationView>();
            foreach (Location location in locations)
            {
                locationViews.Add(location.ConvertToLocationView());
            }
            return locationViews;
        }
    }
}